package com.company.project.service.impl;

import com.company.project.pojo.village.Village;
import com.company.project.mapper.VillageMapper;
import com.company.project.pojo.village.VillageDTO;
import com.company.project.service.IVillageService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 村庄 服务实现类
 * </p>
 *
 * @author 任建波
 * @since 2019-08-10
 */
@Service
public class VillageServiceImpl extends ServiceImpl<VillageMapper, Village> implements IVillageService {

    @Autowired
    private VillageMapper villageMapper;

    /**
     * 获取村庄列表
     */
    @Override
    public List<VillageDTO> getVillageListByInstitutionId(Integer institutionId) {
        List<VillageDTO> villageDTOList = villageMapper.getVillageListByInstitutionId(institutionId);
        return villageDTOList;
    }

    /**
     *根据管理区id和角色id获取村庄列表
     */
    @Override
    public List<VillageDTO> getVillageListByInstitutionIdAndRoleId(Integer roleId, Integer institutionId) {
        List<VillageDTO> villageDTOList = villageMapper.getVillageListByInstitutionIdAndRoleId(roleId, institutionId);
        return villageDTOList;
    }
}
